package com.bbx.taxi.client.Task;

import android.app.Activity;

import com.bbx.api.sdk.model.passanger.CouponCountBuild;
import com.bbx.api.sdk.model.passanger.PriceBuild;
import com.bbx.api.sdk.net.base.BaseNetwork;
import com.bbx.api.sdk.net.passeger.conn.CouponCountNet;
import com.bbx.api.sdk.net.passeger.conn.PriceNet;
import com.bbx.taxi.client.MyApplication;
import com.bbx.taxi.client.Activity.Main.MainActivity;
import com.bbx.taxi.client.Bean.Attribute.MainAttribute;
import com.bbx.taxi.client.Bean.Attribute.MainAttribute.CjType;
import com.bbx.taxi.client.Bean.Message.ObserverListener.DATA_TYPE;

/**
 * @Path com.bbx.taxi.client.Task.MyPriceTask.java
 * @Author 严旭文
 * @Date 2016-8-24 上午10:14:02
 * @Company 蓝海（福建）信息技术有限公司
 * @Description 请求价格
 */
public class MyPriceTask extends BaseTask {
	public static int status;
	public static String msg;
	public DATA_TYPE TYPE = DATA_TYPE.PRICE;
	private PriceBuild mPriceBuild;
	private Activity context;
	/** 用于判断是否是当前的类型，城际，市内，快件 */
	private int view_id;
	/** 判断拼车，包车，顺风车 */
	private CjType citype;

	public MyPriceTask(Activity context, PriceBuild mPriceBuild, int view_id,
			CjType citype) {
		super(context);
		this.context = context;
		this.view_id = view_id;
		this.citype = citype;
		this.mPriceBuild = mPriceBuild;
	}

	@Override
	public boolean isShow() {
		return false;
	}

	@Override
	public boolean isReturnString() {
		return false;
	}

	@Override
	public boolean condition() {
		try {
			MainActivity mainactivity = (MainActivity) context;
			MainAttribute main = MainAttribute.getInstance();
			if (mainactivity.mPresenter.getViewId() == view_id
					&& main.getCjType() == citype) {
				return true;
			} else {
				return false;
			}
		} catch (Exception e) {

			return true;
		}
	}
	@Override
	public void request() {
		setType(TYPE, mPriceBuild);
	}

	@Override
	public void success(int status,Object object) {
		// TODO Auto-generated method stub

	}

	@Override
	public void failed(int status, String msg,String message) {
		this.status = status;
		this.msg = msg;
	}

	@Override
	public BaseNetwork getBaseNetwork() {
		return new PriceNet(context);
	}

}
